package com.qfedu.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qfedu.entity.GoodsEntity;
import com.qfedu.mapper.GoodsMapper;
import com.qfedu.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@com.alibaba.dubbo.config.annotation.Service
public class GoodsServiceimpl implements GoodsService {

    @Autowired(required = false)
    private GoodsMapper goodsMapper;
    @Override
    public Boolean insertGoods(GoodsEntity goodsEntity) {
        Boolean flag = goodsMapper.insertGoods(goodsEntity);
        return flag;
    }

    @Override
    public List<GoodsEntity> queryGoodsBYOid(String oid) {
        List<GoodsEntity> goodsEntities = goodsMapper.queryGoodsBYOid(oid);
        return goodsEntities;
    }

    //状态修改
    @Override
    public boolean updzt(int gid,int gzt) {
        return goodsMapper.updzt(gid,gzt);
    }

    //分页商品
    @Override
    public PageInfo<GoodsEntity> queryfenye(GoodsEntity ge) {
        PageHelper.startPage(ge.getPageNum(),ge.getPageSize());
        List<GoodsEntity> goods = goodsMapper.querygoods(ge);
        PageInfo<GoodsEntity> pageInfo = new PageInfo<>(goods);
        return pageInfo;
    }
}
